//
//  DetailDescribeFirstCell.swift
//  ABSallRec
//
//  Created by 我演示 on 2019/11/7.
//  Copyright © 2019 Jerry-Fu. All rights reserved.
//

import UIKit
import Foundation
import SnapKit

class DetailDescribeFirstCell: UITableViewCell {

    

    @objc var newModel : DetailRootModel!
     
   ///0 : 添加价格属性
    fileprivate var priceLabel : UILabel = {
        let label = UILabel.init("$15", textFont: 12, textAlignment: .left,
                                 textColor: UIColor.initWithHex(hexString: "#333333") )
             label.font = UIFont(name: "Arial Rounded MT Bold", size: 15)
        return label
    }()
    
    /// 1：添加汇率属性
    fileprivate var  exchangeRateLabel : UILabel = {
        let label = UILabel.init("汇率", textFont: 13, textAlignment: .left,
                                 textColor: UIColor.initWithHex(hexString: "#666666"))
        return label
    }()
    
    /// 2: 添加商品名称的id信息
    fileprivate var goodsNameLabel : UILabel = {
        let nameLabel = UILabel.init("商品名称", textFont: 15, textAlignment: .left,
                                     textColor: UIColor.initWithHex(hexString: "#333333"))
        nameLabel.font = UIFont(name: "SourceHanSansCN-Bold", size: 15)
        return nameLabel
    }()
    
    ///3 商品的详细描述的id信息
    fileprivate var goodsDetailLabel : UILabel = {
        let detailTitleLabel = UILabel.init("绿色复古格纹装饰皮革切尔西靴格纹装饰皮革切尔西靴格纹装饰皮革切尔西靴格纹装饰皮革切尔西靴格纹装饰皮女士",
                                            textFont: 12, textAlignment: .left,
                                            textColor: UIColor.initWithHex(hexString: "#666665"));
        detailTitleLabel.numberOfLines = 2
        return detailTitleLabel
    }()
    
    
    ///1: 添加数量信息label操作
     
     @objc var titleNameLabel : UILabel = {
        let label = UILabel.init()

         return label
     }()
     
     // 懒加载属性
     
     
     /// 注意计算属性和存储属性
     @objc  var model : DetailRootModel! {
         set {
             self.newModel = newValue
            self.priceLabel.text = newValue.brandDesc
         }
         get {
             return newModel
         }
     }
     
     override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
         super.init(style: style, reuseIdentifier: reuseIdentifier)
         

         makeUpUI()
         makeUpSubViews()

     }
     
     required init?(coder: NSCoder) {
         fatalError("init(coder:) has not been implemented")
     }
     
     private func makeUpUI() {
         ///1: 添加数量名称
         addSubview(priceLabel)
        
        /// 2: 添加商品名称的id信息
        addSubview(exchangeRateLabel)
        
        ///3 商品的详细描述的id信息
         addSubview(goodsNameLabel)
        
        //4:  商品的详细描述的id信息\
        addSubview(goodsDetailLabel)
     }
     
    private func makeUpSubViews() {

        ///1: 添加数量名称
     priceLabel.snp.makeConstraints { (make) in
        make.left.equalTo(self.snp_left).offset(15)
        make.top.equalTo(self.snp_top).offset(10)
        make.height.equalTo(25)
        make.right.equalTo(self.snp_right).offset(-120)
        }
        
        /// 2: 添加商品名称的id信息
        exchangeRateLabel.snp.makeConstraints { (make) in
            make.top.equalTo(priceLabel.snp_bottom).offset(10)
            make.left.equalTo(self.snp_left).offset(15)
            make.height.equalTo(25)
            make.width.equalTo(180)
        }
        
        ///3:商品详情的描述id
        goodsNameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(exchangeRateLabel.snp_bottom).offset(20)
            make.left.equalTo(self.snp_left).offset(15)
            make.height.equalTo(30)
            make.right.equalTo(self.snp_right).offset(-15)

        }
//
//        ///4: s商品描述的
        goodsDetailLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.snp_left).offset(15)
             make.right.equalTo(self.snp_right).offset(-15)
            make.top.equalTo(goodsNameLabel.snp_bottom).offset(10)
            make.bottom.equalTo(self.snp_bottom).offset(0)

        }
        
        
     }
    
    

}
